Skip to content

quiche: support inplace filter chain update#17988

Merged
alyssawilk merged 15 commits intoenvoyproxy:mainfrom
danzh2010:filterchainupdate
Sep 23, 2021
Merged

quiche: support inplace filter chain update#17988
alyssawilk merged 15 commits intoenvoyproxy:mainfrom
danzh2010:filterchainupdate

Conversation

@danzh2010
Copy link
Copy Markdown
Contributor

@danzh2010 danzh2010 commented Sep 3, 2021

Commit Message: updateListenerConfig() and onFilterChainDraining() to ActiveListener interface and implement them in ActiveQuicListener. Unblock listener update for UDP listener.

Risk Level: high, touches LDS.
Testing: new integration tests
Fixes #13115

Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
@danzh2010
Copy link
Copy Markdown
Contributor Author

/assign @lambdai @mattklein123

Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
@danzh2010
Copy link
Copy Markdown
Contributor Author

api_compat failure is not related. This PR is ready for review!

@danzh2010
Copy link
Copy Markdown
Contributor Author

Ping?

Copy link
Copy Markdown
Member

@ggreenway ggreenway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really good overall. Thanks!

I'd like to have @mattklein123 take a look also; he's the expert in listener updates.

/wait

Signed-off-by: Dan Zhang <danzh@google.com>
@mattklein123 mattklein123 removed their assignment Sep 9, 2021
@ggreenway
Copy link
Copy Markdown
Member

CI is failing; looks like a real failure:

2021-09-09T22:26:06.8171992Z [ RUN      ] QuicHttpIntegrationTests/QuicInplaceLdsIntegrationTest.ReloadConfigUpdateNonDefaultFilterChain/IPv4
2021-09-09T22:26:06.8172771Z =================================================================
2021-09-09T22:26:06.8173657Z ==17==ERROR: AddressSanitizer: use-after-poison on address 0x60c000191790 at pc 0x0000177128f7 bp 0x7f02f5969730 sp 0x7f02f5969728```

/wait

Signed-off-by: Dan Zhang <danzh@google.com>
@danzh2010
Copy link
Copy Markdown
Contributor Author

CI is failing; looks like a real failure:

2021-09-09T22:26:06.8171992Z [ RUN      ] QuicHttpIntegrationTests/QuicInplaceLdsIntegrationTest.ReloadConfigUpdateNonDefaultFilterChain/IPv4
2021-09-09T22:26:06.8172771Z =================================================================
2021-09-09T22:26:06.8173657Z ==17==ERROR: AddressSanitizer: use-after-poison on address 0x60c000191790 at pc 0x0000177128f7 bp 0x7f02f5969730 sp 0x7f02f5969728```

/wait

fixed

@danzh2010
Copy link
Copy Markdown
Contributor Author

/assign @mattklein123

Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't review the H3 code, just the core code. Generally LGTM with a few questions/comments, thank you.

/wait

Comment on lines +42 to +43
if (!Runtime::runtimeFeatureEnabled(
"envoy.reloadable_features.udp_listener_updates_filter_chain_in_place") &&
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: snap this runtime value above.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Network::Socket::Type::Stream ||
Network::Utility::protobufAddressSocketType(config.address()) !=
Network::Socket::Type::Stream) {
;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

del

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines -410 to -412
// buildUdpListenerFactory() must come before buildListenSocketOptions() because the UDP
// listener factory can provide additional options.
buildUdpListenerFactory(socket_type, concurrency);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just so I understand this is removed because this is the in-place update path, which was never supported before for UDP, and now that it is, we use the existing factory or just don't need a factory? Is that right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we already setup udp_listener_config_ in the original listener and it is shared with the new listener a few lines above.

@danzh2010
Copy link
Copy Markdown
Contributor Author

/retest

@repokitteh-read-only
Copy link
Copy Markdown

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #17988 (comment) was created by @danzh2010.

see: more, trace.

Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks LGTM with small remaining comments.

/wait

* route config: added :ref:`dynamic_metadata <envoy_v3_api_field_config.route.v3.RouteMatch.dynamic_metadata>` for routing based on dynamic metadata.
* sxg_filter: added filter to transform response to SXG package to :ref:`contrib images <install_contrib>`. This can be enabled by setting :ref:`SXG <envoy_v3_api_msg_extensions.filters.http.sxg.v3alpha.SXG>` configuration.
* thrift_proxy: added support for :ref:`mirroring requests <envoy_v3_api_field_extensions.filters.network.thrift_proxy.v3.RouteAction.request_mirror_policies>`.
* udp: allows updating filter chain in-place through LDS, which is supported by Quic listener. This will be No-op with error log in other UDP listener implementations. It can be reverted by ``envoy.reloadable_features.udp_listener_updates_filter_chain_in_place``.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs to be updated now that we will reject for non-QUIC?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines +106 to +109
void updateListenerConfig(Network::ListenerConfig&) override { NOT_REACHED_GCOVR_EXCL_LINE; }
void onFilterChainDraining(const std::list<const Network::FilterChain*>&) override {
NOT_REACHED_GCOVR_EXCL_LINE;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add some small comments on why this is not reached?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


void ConnectionHandlerImpl::addListener(absl::optional<uint64_t> overridden_listener,
Network::ListenerConfig& config) {
bool support_udp_in_place_filter_chain_update = Runtime::runtimeFeatureEnabled(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: const

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Network::Socket::Type::Stream ||
Network::Utility::protobufAddressSocketType(config.address()) !=
Network::Socket::Type::Stream) {
if (!Runtime::runtimeFeatureEnabled(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the code that you added in validateFilterChains need to be replicated here? I forget the control flow. Can you add a comment on why this is OK given the other check?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. The problematic config will be rejected later. The following newListenerWithFilterChain() will construct ListenerImpl object and throw if validateFilterChains() fails. validateFilterChains() in called in both ListenerImpl constructors so such config will be rejected no matter it's an in-place update or it's the start up.

Signed-off-by: Dan Zhang <danzh@google.com>
Copy link
Copy Markdown
Contributor Author

@danzh2010 danzh2010 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added feature protection around filter chain validation

* route config: added :ref:`dynamic_metadata <envoy_v3_api_field_config.route.v3.RouteMatch.dynamic_metadata>` for routing based on dynamic metadata.
* sxg_filter: added filter to transform response to SXG package to :ref:`contrib images <install_contrib>`. This can be enabled by setting :ref:`SXG <envoy_v3_api_msg_extensions.filters.http.sxg.v3alpha.SXG>` configuration.
* thrift_proxy: added support for :ref:`mirroring requests <envoy_v3_api_field_extensions.filters.network.thrift_proxy.v3.RouteAction.request_mirror_policies>`.
* udp: allows updating filter chain in-place through LDS, which is supported by Quic listener. This will be No-op with error log in other UDP listener implementations. It can be reverted by ``envoy.reloadable_features.udp_listener_updates_filter_chain_in_place``.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines +106 to +109
void updateListenerConfig(Network::ListenerConfig&) override { NOT_REACHED_GCOVR_EXCL_LINE; }
void onFilterChainDraining(const std::list<const Network::FilterChain*>&) override {
NOT_REACHED_GCOVR_EXCL_LINE;
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


void ConnectionHandlerImpl::addListener(absl::optional<uint64_t> overridden_listener,
Network::ListenerConfig& config) {
bool support_udp_in_place_filter_chain_update = Runtime::runtimeFeatureEnabled(
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Network::Socket::Type::Stream ||
Network::Utility::protobufAddressSocketType(config.address()) !=
Network::Socket::Type::Stream) {
if (!Runtime::runtimeFeatureEnabled(
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. The problematic config will be rejected later. The following newListenerWithFilterChain() will construct ListenerImpl object and throw if validateFilterChains() fails. validateFilterChains() in called in both ListenerImpl constructors so such config will be rejected no matter it's an in-place update or it's the start up.

mattklein123
mattklein123 previously approved these changes Sep 17, 2021
Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@danzh2010
Copy link
Copy Markdown
Contributor Author

/assign @alyssawilk for HTTP/3 side code.

@repokitteh-read-only
Copy link
Copy Markdown

🙀 Error while processing event:

evaluation error
error: function _rk_error error: path contains forbidden characters:
 Traceback (most recent call last):
  bootstrap:143: in <toplevel>
  bootstrap:135: in _main
  bootstrap:62: in _call
  bootstrap:15: in _call1
  github.com/repokitteh/modules/assign.star:18: in _assign
  github:395: in issue_check_assignee
  github:131: in call
Error: function _rk_error error: path contains forbidden characters
🐱

Caused by: a #17988 (comment) was created by @danzh2010.

see: more, trace.

@danzh2010
Copy link
Copy Markdown
Contributor Author

/assign @alyssawilk

@danzh2010
Copy link
Copy Markdown
Contributor Author

@ggreenway mind taking another look?

Copy link
Copy Markdown
Contributor

@alyssawilk alyssawilk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tackling this one! Couple of nits below


/**
* Update the listener config. The follow up connections will see the new config. The existing
* The follow up connections will see the new config. The existing
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this comment changed intentionally? I think it made more sense before

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's by mistake. Fixed

ASSERT_TRUE(response->waitForReset());
}

class QuicInplaceLdsIntegrationTest : public QuicHttpIntegrationTest {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we not reuse LdsInplaceUpdateHttpIntegrationTest.ReloadConfigAddingFilterChain and friends?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, that test uses various ALPN to distinguish filter chains, but QUIC only supports "h3".

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha. If you make any further changes can you comment as such? Or alternately if when you address the ALPN TODO you could then share code maybe TODO the test migration?

open_connections_ = origin.open_connections_;

if (socket_type == Network::Socket::Type::Stream) {
// Apply below tcp only initialization.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Apply the options below only for TCP.

(though I'm surprised socket options doesn't apply to UDP?)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.
buildSocketOptions() is not called for UDP in the other ListenerImpl constructor either. It initializes connection balancer and sets TCP fast open which doesn't apply to UDP.

Signed-off-by: Dan Zhang <danzh@google.com>
Copy link
Copy Markdown
Contributor

@alyssawilk alyssawilk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quiche part looks good. I'd appreciate Greg or Matt signing off on the reload since they're more familiar with that.

ASSERT_TRUE(response->waitForReset());
}

class QuicInplaceLdsIntegrationTest : public QuicHttpIntegrationTest {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha. If you make any further changes can you comment as such? Or alternately if when you address the ALPN TODO you could then share code maybe TODO the test migration?

@danzh2010
Copy link
Copy Markdown
Contributor Author

/retest

@repokitteh-read-only
Copy link
Copy Markdown

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #17988 (comment) was created by @danzh2010.

see: more, trace.

@danzh2010
Copy link
Copy Markdown
Contributor Author

@ggreenway @mattklein123 any other comments?

@danzh2010
Copy link
Copy Markdown
Contributor Author

Ping @ggreenway @mattklein123

@ggreenway
Copy link
Copy Markdown
Member

Apologies; I'm very busy this week. I may not be able to review until next Monday.

Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm OK from my side, thank you.

@alyssawilk
Copy link
Copy Markdown
Contributor

That's 2 senior reviewers so I'm inclined to just merge if no one objects

@ggreenway
Copy link
Copy Markdown
Member

That's 2 senior reviewers so I'm inclined to just merge if no one objects

I did a pass earlier, and I think all my concerns have been addressed. I vote for merging it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

quic: support in-place filterChainUpdate

6 participants